﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<TPOJ.Model.Solution>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Problem <%=Html.Encode(ViewData["problemId"]) %> Status List
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="problemStatusContainer">
<div id="problemStatistics">
    <h2>Statistics</h2>
    <table>
        <tr>
            <th>
                Total Submissions
            </th>
            <td>
                <% var record = (TPOJ.Web.ViewModel.StatisticsRecord)ViewData["Statistics"]; %>
                <%= record.ResultsCount.Sum(r=>r.Value) %>
            </td>
         </tr>
         <tr>
            <th>
                Users (Submitted)
            </th>
            <td>
                <%= record.UserCountSubmitted %>
            </td>
         </tr>
         <tr>
            <th>
              Users (Solved)
            </th>
            <td>
                <%= record.UserCountSolved %>
            </td>
         </tr>
         <tr>
            <th>
                Accepted
            </th>
            <td>
                <%= record.ResultsCount[(byte)TPOJ.Core.ResultType.Accepted] %>
            </td>
         </tr>
         <tr>
            <th>
                Representation Error
            </th>
            <td>
                <%= record.ResultsCount[(byte)TPOJ.Core.ResultType.RepresentationError] %>
            </td>
         </tr>
         <tr>
            <th>
                Time Limit Exceeded
            </th>
            <td>
                <%= record.ResultsCount[(byte)TPOJ.Core.ResultType.TimeLimitExceeded] %>
            </td>
         </tr>
         <tr>
            <th>
                Memory Limit Exceeded
            </th>
            <td>
                <%= record.ResultsCount[(byte)TPOJ.Core.ResultType.MemoryLimitExceeded] %>
            </td>
         </tr>
         <tr>
            <th>
                Wrong Answer
            </th>
            <td>
                <%= record.ResultsCount[(byte)TPOJ.Core.ResultType.WrongAnswer] %>
            </td>
         </tr>
         <tr>
            <th>
                Runtime Error
            </th>
            <td>
                <%= record.ResultsCount[(byte)TPOJ.Core.ResultType.RuntimeError] %>
            </td>
         </tr>
         <tr>
            <th>
                Output Limit Exceeded
            </th>
            <td>
                <%= record.ResultsCount[(byte)TPOJ.Core.ResultType.OutputLimitExceeded] %>
            </td>
         </tr>
         <tr>
            <th>
                Compile Error
            </th>
            <td>
                <%= record.ResultsCount[(byte)TPOJ.Core.ResultType.CompileError] %>
            </td> 
         </tr>
         <tr>
            <th>
                System Error
            </th>
            <td>
                <%= record.ResultsCount[(byte)TPOJ.Core.ResultType.SystemError] %>
            </td> 
         </tr>
         <tr>    
            <th>
                Pending
            </th>
            <td>
                <%= record.ResultsCount[(byte)TPOJ.Core.ResultType.Pending] %>
            </td>   
        </tr>
    </table>
</div>
<div id="bestSolutions">
    <h2>Best solutions of Problem <%=Html.Encode(ViewData["problemId"]) %></h2>

    <table>
        <tr>
            <th>
                Rank
            </th>
            <th>
                User
            </th>
            <th>
                Time
            </th>
            <th>
                Memory
            </th>
            <th>
                Code Length
            </th>
            <th>
                Language
            </th>
            <th>
                Submit Time
            </th>
        </tr>
    <% int i = 0; %>
    <% foreach (var item in Model) { %>
    <% i++; %>
        <tr>
            <td>
                <%= i %>
            </td>
            <td>
                <%= Html.Encode(TPOJ.Web.Utils.GetUserName(item.AccountID)) %>
            </td>
            <td>
                <%= Html.Encode(item.Time) %>MS
            </td>
            <td>
                <%= Html.Encode(item.Memory) %>K
            </td>            
            <td>
                <%= Html.Encode(item.CodeLength) %>B
            </td>
            <td>
                <%= Html.Encode(item.Language) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:g}", item.DateTime))%>
            </td>
        </tr>
    
    <% } %>

    </table>
</div>
</div>
</asp:Content>

